package com.java.comprehensive.arithmetic.leecode.tags.tree;

import util.TreeNode;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: Dgg
 * @Date: 2021/12/28 20:00
 */
public class LeetCode_145 {

	public List<Integer> postorderTraversal(TreeNode root) {
		List<Integer> list = new ArrayList<>();
		getTree(root, list);
		return list;
	}

	public static void getTree(TreeNode root, List<Integer> list) {
		if (root == null) {
			return;
		}
		getTree(root.left, list);
		getTree(root.right, list);
		list.add(root.val);

	}

}
